package com.huaxin.device.models;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.huaxin.device.dto.enums.EquipmentStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 电力设备主表（变压器、断路器等）
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("electrical_equipment")
@Schema(description = "电力设备")
public class ElectricalEquipment extends BaseModel {

    @TableField(value = "equipment_name")
    @Schema(description = "设备名称", example = "干式变压器T1")
    private String equipmentName;

    @TableField(value = "equipment_code")
    @Schema(description = "设备编号", example = "EQP-TR-001")
    private String equipmentCode;

    @TableField(value = "model_id")
    @Schema(description = "型号ID", example = "m123e456-789a-bcde-f012-3456789abcde")
    private String modelId;

    @TableField(value = "category_id")
    @Schema(description = "分类ID", example = "c123e456-789a-bcde-f012-3456789abcdf")
    private String categoryId;

    @TableField(value = "install_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "安装日期", example = "2023-01-15 09:00:00")
    private LocalDateTime installDate;

    @TableField(value = "manufacturer")
    @Schema(description = "生产厂家", example = "ABB中国有限公司")
    private String manufacturer;

    @TableField(value = "serial_number")
    @Schema(description = "出厂序列号", example = "SN2023ABCT1")
    private String serialNumber;

    @TableField(value = "rated_voltage")
    @Schema(description = "额定电压", example = "10kV/400V")
    private String ratedVoltage;

    @TableField(value = "rated_current")
    @Schema(description = "额定电流（A）", example = "1000")
    private Integer ratedCurrent;

    @TableField(value = "power_rating")
    @Schema(description = "额定容量（kVA/kW）", example = "1000.00")
    private BigDecimal powerRating;

    @TableField(value = "status")
    @Schema(description = "运行状态：normal, fault, maintenance, repair, offline", example = "normal")
    private EquipmentStatus status;

    @TableField(value = "last_maintenance_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "上次维保时间", example = "2025-01-15 10:00:00")
    private LocalDateTime lastMaintenanceDate;

    @TableField(value = "next_maintenance_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "下次维保时间", example = "2026-01-15 10:00:00")
    private LocalDateTime nextMaintenanceDate;

    @TableField(value = "description")
    @Schema(description = "备注")
    private String description;

    @TableField(value = "room_id")
    @Schema(description = "所属配电房ID", example = "r123e456-789a-bcde-f012-3456789abcde")
    private String roomId;

    @TableField(value = "cabinet_id")
    @Schema(description = "所属变电箱ID", example = "cb123e456-789a-bcde-f012-3456789abcde")
    private String cabinetId;

    @TableField(value = "well_id")
    @Schema(description = "所属电井ID", example = "w123e456-789a-bcde-f012-3456789abcde")
    private String wellId;

    @TableField(value = "family_id")
    @Schema(description = "家庭ID", example = "family-01")
    private String familyId;
}